#
# Makefile template for MPW Perl. Copyright � 1991-93 Matthias Neeracher & Tim Endres 
# 
# Turn this into a Makefile by running it or by editing it manually
#

Perl -Sx "{0}"
Exit

#!/usr/local/bin/perl

rename("Makefile", "Makefile.bak");

unless (open(MAKEFILE, ">Makefile")) {
	rename("Makefile.bak", "Makefile");
	
	die "Failed to open Makefile for writing.";
}

while (<DATA>) {
	last if (/^### BEGIN/);
	print MAKEFILE;
}

while (<DATA>) {
	last if (/^### END/);
	if (/(\w+)(\s*=\s*)(\S*)/) {
		$repl = ask($1, $3);
		
		if ($repl) {
			print MAKEFILE $1, $2, $repl, "\n";
		} else {
			print MAKEFILE;
		}
	}
}

while (<DATA>) {
	print MAKEFILE;
}

__END__
#######################################################################
#	Project	:	Perl				-	
#	File		:	Makefile			-	Generated automatically from Makefile.in
#	Author	:	Copyright � 1991-93 Matthias Neeracher & Tim Endres
# 		You may distribute under the terms of the Perl Artistic License,
#     as specified in the README file.
#	Started	:	22Oct93								Language	:	MPW Shell/Make
#	Modified	:	22Oct93	MN	
#	Last		:	22Oct93
#######################################################################

### BEGIN LOCAL DEFINITIONS.	Don't change this line !
PerlSrc 		= :
PerlObj		= :Obj:
bin 			= "{MPW}Tools"	
privlib 		= "{MPW}Libraries:PerlLibs"
helpdir		= "{Boot}411"
YACC 			= yacc
### END LOCAL DEFINITIONS.	Don't change this line !

COptions		= -mbg full -sym on -mf -i {PerlSrc} -d DEBUGGING

public 		= Perl 
scripts 		= h2ph

LibFiles		= 	"{CLibraries}GUSI.o"						�
					"{CLibraries}GUSI_Everything.cfg"	�
					"{CLibraries}StdCLib.o" 				�
					"{Libraries}RTLib.o" 					�
					"{Libraries}Runtime.o" 					�
					"{Libraries}Interface.o" 				�
					"{Libraries}ToolLibs.o"					�
					"{CLibraries}Math.o" 					�
					"{CLibraries}CSANELib.o"				�
					"{CLibraries}libdb.o"

ObjectFiles	=	{PerlObj}alloca.c.o 						�
					{PerlObj}array.c.o 						�
					{PerlObj}cmd.c.o 							�
					{PerlObj}cons.c.o 						�
					{PerlObj}consarg.c.o 					�
					{PerlObj}doarg.c.o 						�
					{PerlObj}doio.c.o 						�
					{PerlObj}dolist.c.o 						�
					{PerlObj}dump.c.o							�
					{PerlObj}eval.c.o 						�
					{PerlObj}form.c.o 						�
					{PerlObj}hash.c.o 						�
					{PerlObj}icemalloc.c.o					�
					{PerlObj}missing.c.o	 					�
					{PerlObj}reentrant.c.o					�
					{PerlObj}regcomp.c.o	 					�
					{PerlObj}regexec.c.o						�
					{PerlObj}stab.c.o 						�
					{PerlObj}str.c.o 							�
					{PerlObj}toke.c.o 						�
					{PerlObj}util.c.o 						�
					{PerlObj}SubLaunch.a.o					�
					{PerlObj}SubLaunch.c.o					�
					{PerlObj}usersub.c.o						�
					{PerlObj}macperl.c.o
					
{PerlObj}	�	{PerlSrc}
.c.o			�	.c
	{C} {COptions} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o

# These are the top level targets
	
All			�	Perl Perl.o

Perl			��	{PerlObj}perly.c.o {PerlObj}perl.c.o				�
					{ObjectFiles} {CLibraries}GUSI.o
	Link -model far -sym on -mf -c 'MPS ' -t MPST {LOptions} 	�
		{PerlObj}perly.c.o 					�
		{PerlObj}perl.c.o						�
		{ObjectFiles} 							�
		{LibFiles} 								�
		-o Perl
		
Perl			��	{PerlSrc}Perl.r {PerlSrc}Perl.rsrc
	Rez -a -c 'MPS ' -t MPST -s {PerlSrc} {PerlSrc}Perl.r -o Perl

PerlHelp.index	�	PerlHelp
	Entab -a 250 PerlHelp > PerlHelp.nu
	Rename -y PerlHelp.nu PerlHelp
	Get PerlHelp -q -y -k PerlHelp >Dev:Null
	
Distribution	� Perl PerlHelp.index
	Distribute PerlTool.distr Mac_Perl_410_tool.sit

InstallPerl		� Perl PerlHelp.index
	Install {bin} {privlib} {helpdir}

Install			�	InstallPerl

Clean�
	delete -y {PerlObj}�.o all Perl Perl.o

# Nondefault dependences

Perl.o		� {PerlObj}perly.c.o {PerlObj}saperl.c.o {ObjectFiles}
	Lib -mf {LibFlags} {ObjectFiles} {PerlObj}perly.c.o {PerlObj}saperl.c.o -o Perl.o

{PerlObj}perly.c.o	� {PerlSrc}perly.c
	{C} {COptions} -model far -s perly {PerlSrc}perly.c -o {PerlObj}perly.c.o
{PerlObj}initexternals.c.o	� initexternals.c
	{C} {COptions} -model far -s initexternals initexternals.c -o {PerlObj}initexternals.c.o
{PerlObj}saperl.c.o	� {PerlSrc}perl.c
	{C} {COptions} -d MAC_STANDALONE -s perl -d main=run_perl {PerlSrc}perl.c -o {PerlObj}saperl.c.o
{PerlSrc}perly.h		� {PerlSrc}perly.c
{PerlSrc}perly.c		� {PerlSrc}perly.y
	echo 'Expect either' 29 shift/reduce and 59 reduce/reduce conflicts...
	echo '           or' 27 shift/reduce and 61 reduce/reduce conflicts...
	{YACC} -d {PerlSrc}perly.y
	rename {PerlSrc}y.tab.c {PerlSrc}perly.c
	Perl -i.bak -pe 's/printf\(\"yydebug/fprintf\(perldbg, \"yydebug/' {PerlSrc}perly.c
	rename {PerlSrc}y.tab.h {PerlSrc}perly.h
	echo 'extern YYSTYPE yylval;' >>{PerlSrc}perly.h
